//
//  SimplePricing.m
//  CodeKatas
//
//  Created by Viktor Lazarevich on 27-Feb-10.
//  Copyright 2010 Home. All rights reserved.
//

#import "SimplePricing.h"


@implementation SimplePricing

- (id)init {
	return [self initWithPrice:MakeMoney(0, 0)];
}

- (id)initWithPrice: (Money)price {
	if (TotalCents(price) <= 0) {
		[self release];
		return nil;
	}
	
	if (self = [super init]) {
		pricePerOne = price;
	}
	return self;
}

- (Money)getPriceFor: (Quantity) quantity {
	return Multiply(pricePerOne, quantity);
}

@end
